#pragma once
#include "src/common/common.h"


template<typename T>
void ptr_data_init(T* p,int n);

template<>
void ptr_data_init(half* p,int n);


template<typename T >
bool check_cpu_cuda_cal_result(T* A,T* B,int m,int k);

template<>
bool check_cpu_cuda_cal_result(half* A,half* B,int m,int k);



class HostTimer
    {
    public:
        HostTimer();
        float getUsedTime(); // while timing for cuda code, add "cudaDeviceSynchronize();" before this
        ~HostTimer();

    private:
        std::chrono::steady_clock::time_point t1;
        std::chrono::steady_clock::time_point t2;
    };


    class DeviceTimer
    {
    public:
        DeviceTimer();
        float getUsedTime();
        // overload
        DeviceTimer(cudaStream_t ctream);
        float getUsedTime(cudaStream_t ctream);

        ~DeviceTimer();

    private:
        cudaEvent_t start, end;
    };